
#ifndef _MEMBER_BTabWidget_H_
#define _MEMBER_BTabWidget_H_

#include <BIcon>
#include <BStyle>
#include <BAction>
#include <BTabWidget>
#include "ITabBoard.h"

#define tab_member(tab)		((member_BTabWidget*)((BTabWidget*)tab)->_ptr)

namespace BWE
{
	class member_BTabWidget : public BObject
	{
		friend class BTabWidget;
	public:
		member_BTabWidget(BTabWidget* tabWidget);
		~member_BTabWidget();

		void freshTabItems();

		int indexOf(const BWidget* widget);
		BRect rectOf(const BWidget* widget);

		void slotWidgetShow(BWidget* widget, const BValue& value);
		void slotWidgetHide(BWidget* widget, const BValue& value);
		void slotWidgetIconChanged(BObject* object, const BValue& value);
		void slotWidgetTitleChanged(BObject* object, const BValue& value);

		void slotCloseButtonClicked(BObject* object, const BValue& value);
		void slotCloseButtonStyled();
		void slotBoardActived(BObject* object, const BValue& value);
		void slotArrowChecked(BObject* object, const BValue& value);

		BTabWidget*		boss;
		Align			tabAlign;
		PartFlag		tabPart;
		bool			tabVisible;
		int				tabSpacing;
		BMargin			tabMargin;
		BSize			tabSize;
		BSize			arrowSize;
		Align			arrowAlign;
		bool			arrowVisible;
		bool			autoTop;
		bool			autoLeft;
		bool			autoRight;
		bool			autoBottom;

		BHolder<BButton>		arrow;
		BHolder<ITabBoard>		board;
		BHolder<const BStyle>	tabStyle;
		BHolder<const BStyle>	closeStyle;

		bool				dirty;
		BRect				tabArea;
		int					hoverIndex;
		bool				pressed;
		BWidgetArray		stack;
		BList<TabItem>		items;
		BHolder<BWidget>	tabClosing;
	};
}

#endif